<template>
  <van-nav-bar title="物流进度" left-text="" left-arrow @click-left="onClickLeft" />

  <van-steps direction="vertical" :active="0">
    <van-step v-for="item in expressList.list">
      <h3>{{ item.status }}</h3>
      <p>{{ item.time }}</p>
    </van-step>
    <!-- <van-step>
      <h3>【城市】物流状态2</h3>
      <p>2016-07-11 10:00</p>
    </van-step>
    <van-step>
      <h3>快件已发货</h3>
      <p>2016-07-10 09:30</p>
    </van-step> -->
  </van-steps>

</template>

<script setup>
import { onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { POST } from "../services/request";

const route = new useRoute();
const router =  new useRouter();

// 获取query传过来的订单id
const orderId = route.query.orderId
// console.log(orderId,'111');
// 存放物流列表信息
const expressList = ref([])

onMounted(async()=>{
  await getExpress();
})

// 通过订单编号查询物流信息
const getExpress = async()=>{
  console.log(111);
  
  const getExpressRes = await POST({
    url:'/Order/getExpressInfo',
    params:{
      orderId
    }
  })
  // console.log(getExpressRes);
  if(getExpressRes.code === 1){
  // console.log(JSON.parse(...getExpressRes.data));
  expressList.value = getExpressRes.data.result
  console.log(expressList.value);
  }
}

const onClickLeft =()=>history.back()


</script>